<?php


namespace App\HttpController\Mp1;


use App\Exceptions\BizException;
use Base\BaseController;
use App\Bizs\Mp1\GiveBiz;

class Give extends BaseController
{
    /**
     * @Apiname 发送送养信息
     *
     * @Param column {"type": "string", "require": true, "desc": "栏目"}
     * @Param name {"type": "string", "require": true, "desc": "名字"}
     * @Param age_month {"type": "int", "require": true, "desc": "年龄"}
     * @Param gender {"type": "string", "require": true, "desc": "性别"}
     * @Param nojj {"type": "int", "require": true, "desc": "绝育"}
     * @Param worm {"type": "int", "require": true, "desc": "驱虫"}
     * @Param inject {"type": "string", "require": true, "desc": "疫苗"}
     * @Param source {"type": "string", "require": true, "desc": "来源"}
     * @Param remark {"type": "string", "require": true, "desc": "备注"}
     * @Param images {"type": "string", "require": true, "desc": "图片"}
     * @Param friend_name {"type": "string", "desc": "其他联系人"}
     * @Param friend_mobile {"type": "string", "desc": "其他联系人"}
     * @Param friend_weixin {"type": "string", "desc": "其他联系人"}
     * @throws BizException
     */
    public function sendGive()
    {
        $this->returnJson((new GiveBiz())->sendGive($this->params, $this->uid));
    }

    /**
     * @Apiname 获取送养列表
     *
     * @Param column {"type": "string", "desc": "分类"}
     * @Param user_id {"type": "int", "desc": "要看谁的列表"}
     * @Param my_wanna {"type": "int", "desc": "看我想要的"}
     * @Param need_verify {"type": "int", "desc": "待审核的"}
     * @Param page {"type": "int", "default": 1, "desc": "第几页"}
     * @Param limit {"type": "int", "default": 20, "desc": "每页几个"}
     */
    public function getGiveList()
    {
        $this->returnJson((new GiveBiz())->getGiveList($this->params, $this->uid, $this->userinfo));
    }

    /**
     * @Apiname 删除送养
     *
     * @Param id {"type": "int", "desc": "送养id"}
     * @throws BizException
     */
    public function deleteGive()
    {
        $this->returnJson(
            (new GiveBiz())->deleteGive($this->params, $this->uid)
        );
    }

    /**
     * @Apiname 获取送养详情
     * @Param id {"type": "int", "desc": "送养id"}
     * @throws BizException
     */
    public function getGiveDetail()
    {
        $this->returnJson(
            (new GiveBiz())->getGiveDetail($this->params, $this->uid)
        );
    }

    /**
     * @Apiname 想要
     * @Param give_id {"type": "int", "desc": "送养id"}
     * @Param content {"type": "string", "desc": "内容"}
     * @throws BizException
     */
    public function wanna()
    {
        $this->returnJson(
            (new GiveBiz())->wanna($this->params, $this->uid)
        );
    }

    /**
     * @Apiname 审核
     * @Param give_id {"type": "int", "desc": "送养id"}
     * @Param verify {"type": "int", "desc": "审核通过1 拒绝2"}
     * @Param refuse_reason {"type": "string", "desc": "拒绝理由"}
     * @throws BizException
     */
    public function verify()
    {
        $this->returnJson(
            (new GiveBiz())->verify($this->params, $this->uid)
        );
    }

    /**
     * @Apiname 获取想要人的列表
     * @Param give_id {"type": "int", "desc": "送养id"}
     */
    public function getWannaList()
    {
        $this->returnJson((new GiveBiz())->getWannaList($this->params, $this->uid));
    }

    /**
     * @Apiname 标记已经送出
     * @Param give_id {"type": "int", "desc": "送养id"}
     * @Param give_user_id {"type": "int", "desc": "送给谁了"}
     * @Param give_remark {"type": "string", "desc": "送完了说点啥"}
     */
    public function given()
    {
        $this->returnJson((new GiveBiz())->given($this->params, $this->uid));
    }

    /**
     * @Apiname 编辑送养
     * @Param give_id {"type": "int", "desc": "送养id"}
     * @Param name {"type": "string", "require": true, "desc": "名字"}
     * @Param age_month {"type": "int", "require": true, "desc": "年龄"}
     * @Param gender {"type": "string", "require": true, "desc": "性别"}
     * @Param nojj {"type": "int", "require": true, "desc": "绝育"}
     * @Param worm {"type": "int", "require": true, "desc": "驱虫"}
     * @Param inject {"type": "string", "require": true, "desc": "疫苗"}
     * @Param source {"type": "string", "require": true, "desc": "来源"}
     * @Param remark {"type": "string", "require": true, "desc": "备注"}
     * @Param images {"type": "string", "require": true, "desc": "图片"}
     * @Param friend_name {"type": "string", "desc": "其他联系人"}
     * @Param friend_mobile {"type": "string", "desc": "其他联系人"}
     * @Param friend_weixin {"type": "string", "desc": "其他联系人"}
     */
    public function editGive()
    {
        $this->returnJson((new GiveBiz())->editGive($this->params, $this->uid, $this->userinfo));
    }
}
